#ifndef METHOD_HPP
#define METHOD_HPP

#include "equation.hpp"
#include <functional>
#include <string>

template <typename solve_function_t> class Method {
private:
  solve_function_t solver;
  std::string name;

protected:
  solve_function_t const &get_solver() const { return this->solver; }

public:
  explicit Method(solve_function_t const &f, std::string &&name)
      : solver(f), name(std::move(name)){};

  virtual double solve(Equation const &eq, double a, double b,
                       double accuracy) const = 0;
  std::string const &getName() const { return name; }
  virtual ~Method() = default;
};

#endif /* METHOD_HPP */
